package xyz.hujf.tool.并发包原理解析;

import java.util.concurrent.locks.LockSupport;

/**
 * @author Hujf
 * @title: LockSupportTest
 * @date 2021-04-27 17:29
 * @description: TODO
 */
public class LockSupportTest {

    public static void main(String[] args) throws InterruptedException {
        System.out.println("开始");

        LockSupport.unpark(Thread.currentThread());
        LockSupport.park();

        System.out.println("end park");

       Thread a1= new Thread(()->{
           System.out.println("123123123");
            LockSupport.park();
           System.out.println("----");
        });
        a1.start();
        Thread.sleep(1000);
        LockSupport.unpark(a1);
      //  a1.interrupt();
        a1.join();
        System.out.println("Main is over");

    }
}
